//
//  RectiffyController.m
//  Rectiffy
//
//  Created by Jesper on 2007-07-26.
//  Copyright 2007 waffle software. All rights reserved.
//

#import "RectiffyController.h"
#import "MyDocument.h"


@implementation RectiffyController

static RectiffyController *sharedController = nil;

+ (RectiffyController *)sharedController {
	return sharedController;
}

- (void)awakeFromNib {
	sharedController = self;
}

- (IBAction)trampolineAdd:(id)sender {
	MyDocument *doc = [[NSDocumentController sharedDocumentController] currentDocument];
	[doc addRep:sender];
}

- (IBAction)trampolineRemove:(id)sender {
	MyDocument *doc = [[NSDocumentController sharedDocumentController] currentDocument];
	[doc removeRep:sender];	
}

- (IBAction)trampolineViewingIntended:(id)sender {
	MyDocument *doc = [[NSDocumentController sharedDocumentController] currentDocument];
	[doc setViewingIntended:1];
}

- (IBAction)trampolineViewingNotIntended:(id)sender {
	MyDocument *doc = [[NSDocumentController sharedDocumentController] currentDocument];
	[doc setViewingIntended:0];
}

- (void)updateViewingIntendedMenus {
	MyDocument *doc = [[NSDocumentController sharedDocumentController] currentDocument];
	BOOL intended = ([doc viewingIntended] == 1);
		
	[viewingIntended setState:(intended ? NSOnState : NSOffState)];
	[viewingNotIntended setState:(!intended ? NSOnState : NSOffState)];
}
@end
